home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.4 KB | 57 lines | [TEXT/GEOL] |
- Item 6273197 5-Sept-90 10:25PDT
-
- From: KNEPPER Knepper, Christopher
-
- To: PEMD CH DEV PEMD Group, Zurich,IDV
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: Re: Drawing Problem Solved
-
- Ernie,
-
- >I strikes me as a bit strange that the default focus should be the last window
- >drawn rather than the front, active window. Does it also seemed that way to
- >you?
-
- I don't think it's so much a question of the default focus being the last
- window drawn, rather I think it's a question of always focusing before drawing.
- When the windows are refreshed front-to-back, the last window is the one that
- is last drawn, and therefore, since it was last drawn, it is the one last
- focused (in TView.DrawContents) and that is the one that is the "default"
- focus.
-
- However, I don't think that you should think in terms of a "default" focus,
- rather I think that you need to think in terms of:
- "always focus before drawing"
- Rather than,
- "where was the focus last set" or
- "always focus before dispatching a menu command"
-
- If you take this philosophy, you'll get much further than trying to figure out
- where the "default" or "last" focus was set, or trying to figure out if a menu
- command could potentially cause drawing to occur and therefore requires
- focusing before dispatching the menu command.
-
- Finally, I would like to differ with you as to your solution. I think that you
- need to "always focus before drawing" rather than focusing in
- "myView.DoMenuCommand" which is sort of like "always focus before dispatching a
- menu command". Although the effect may be the same, the philosophy of
- programming is quite different, and I think that it breaks the
- object-orientedness of your code.
-
- The best solution of all would be to have a menu command not perform any
- drawing at all, but instead to have it change the model (the TDocument, by
- default) and then ask document to render the changed model, notifying the view
- imaging the model (myView) to redraw its contents as necessary. The advantage
- of this approach is that it removes drawing from the menu command, and sticks
- it in the view (where it belongs).
-
- If you take this approach, then the drawing is done by "myView.Draw()" and
- you're gauranteed to be focused when that gets called (by DrawContents), so the
- problem of figuring out when/where to focus is greatly reduced, if not
- eliminated all together.
-
- -Chris
-
-